<script type="text/javascript">
var uid=1;
$(function(){
    var swfu_= new SWFUpload({
				upload_url: "/file/swfup",
				//上传文件的名称
				post_params: {"uid": uid},
                file_post_name: "filedata",
				file_size_limit : "1 MB",
				file_types : "*.jpg;*.png;*.jpeg'*.bmp",
				file_types_description : "bmp,jpeg,jpg,png图片",
				file_upload_limit :5,
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : function(f,data){
					eval("var json="+data+";");
					if(json.suc==true){
						var htmstr="";
						htmstr+="<div style='float:left;'>";
						htmstr+='<input type="hidden" name="logos" value="'+json.msg+'">';
						htmstr+='<img height="200px"src="'+json.msg+'"/>';
						htmstr+='<br/><a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();">删除</a>';
						htmstr+='</div>';
						$("#img_div").append(htmstr);
						$('.easyui-linkbutton').linkbutton({    
						    iconCls: 'icon-remove'
						}); 
					}else{
						$.messager.alert('警告','文件上传出错');
					}
				},
				upload_complete_handler : uploadComplete,
				// Button Settings
				button_image_url : "/img/SmallSpyGlassWithTransperancy_17x18.png",
				button_placeholder_id : "upbtn",
				button_width: 80,
				button_height: 18,
				button_text : '<span class="button">上传商品图片</span>',
				button_text_style : '.button {font-size: 12pt; }',
				button_text_top_padding: 0,
				button_text_left_padding: 18,
				button_disabled : false,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				// Flash Settings
				flash_url : swfuploaddir+"/swfupload.swf",
				flash9_url : swfuploaddir+"/swfupload_fp9.swf",
				custom_settings : {
				//	upload_target : "divFileProgressContainer",
					thumbnail_height: 500,
					thumbnail_width: 500,
					thumbnail_quality: 100
				},
				debug: true
			});
			$("#shop_id").combobox({    
			    url: '/shop/combobox',    
			    required: true,
			    valueField:'id',    
	    		textField:'name', 
			    width:150,
			    onSelect: function(rec){    
			    	$('#product_type_id').combotree('clear');
		            var url = '/productType/combotree/'+rec.id;    
		            $('#product_type_id').combotree('reload', url);
		        } 
			}); 
			$("#product_type_id").combotree({    
			    url: '/productType/combotree/${(po.shop_id)!}',    
			    width:250,
		        required: true
			});
});

</script>
<form method="post" id="editForm" name="editForm">
	<input type="hidden" name="product.id" value="${(po.id)!}" id="poid">
	<div id="tt" class="easyui-tabs" style="width: 786px; height: 450px;">
		<div title="商品信息" style="padding: 5px;">
			<table class="tableForm tableCss">
				<tr>
					<th>商户</th>
					<td colspan="3">
						 <input id="shop_id" name="product.shop_id" value="${(po.shop_id)!}"> 
					</td>
				</tr>
				<tr>
					<th><font color=red>*</font>类别名称</th>
					<td colspan="3">
						<input id="product_type_id" name="product.product_type_id" value="${(po.product_type_id)!0}"/>
					</td>
				</tr>
				<tr>
					<th><font color=red>*</font>商品名称</th>
					<td ><input type="text" name="product.name"
						class="easyui-validatebox" value="${(po.name)!}"
						data-options="required:true"></td>
					<th>排序</th>
					<td><input type="text" name="product.seq"
						class="easyui-numberspinner" value="${(po.seq)!0}"></td>
				</tr>
					
				<tr>
					<th>原价(元)</th>
					<td><input type="text" name="product.old_price"
						class="easyui-numberbox" data-options="min:0,precision:2"
						 value="${(po.old_price)!}"></td>
					<th>现价(元)</th>
					<td><input type="text" name="product.now_price"
						class="easyui-numberbox" data-options="min:0,precision:2" 
						value="${(po.now_price)!}"></td>
					
				</tr>
			
				<tr>
					<th>单位</th>
					<td><input type="text" name="product.unit" class="easyui-validatebox" value="${(po.unit)!}"
						data-options=""></td>
					<th>规格</th>
					<td><input type="text" name="product.spec" class="easyui-validatebox" value="${(po.spec)!}"></td>
				</tr>
				<tr>
					<th>上架状态</th>
					<td>
						<input name="product.up_status" class="easyui-combobox" value="${(po.up_status)!0}" 
						data-options="valueField: 'label',textField: 'value',
						data: [{label: '0',value: '上架'},{label: '1',value: '下架'}]">
					</td>
					<th>删除状态</th>
					<td>
						<input name="product.status" class="easyui-combobox" value="${(po.status)!0}" 
						data-options="valueField: 'label',textField: 'value',
						data: [{label: '0',value: '正常'},{label: '1',value: '已删除'}]">
					</td>
				</tr>
				<tr>
					<th>简介</th>
					<td colspan="3">
						<textarea name="product.desc" rows="3" cols="60">${(po.desc)!}</textarea>
					</td>
				</tr>
					<tr>
				</tr>
			</table>
		</div>
		<div title="图片" style="padding:5px;">
			<div class="tableForm datagrid-toolbar" >
				<div style="width:60px;border:1px;">
					<span id="upbtn"></span>
				</div>
				<div id="img_div">
					<#if po?? && po.productImgs??>
						<#list  po.productImgs as x>
							<div style='float:left;'>
								<input type="hidden" name="logos" value="${x.url}">
								<img src="${x.url}" height="200px"/>
								<br/>
								<a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();">删除</a>
							</div>
						</#list>
					</#if>
				</div>
			</div>
		</div>
		<div title="商品描述" style="padding:5px;">
		<textarea name="product.remark" class="keditor" style="width:750px;height:400px;">${(po.remark)!}</textarea>
		</div>
	</div>
</form>

